//go:generate protoc -I ../../../protobuf/gateway:../../../protobuf/common --go_out=plugins=grpc,Mcommon.proto=aquaman/app/biz/m:../.. train.proto

package train

import (
	"context"
)

type GrpcBinding struct {
	Service
}

func NewGRPC(svc *Service) *GrpcBinding {
	return &GrpcBinding{Service: *svc}
}

func (s *GrpcBinding) GetTrains(ctx context.Context, in *GetTrainsRequest) (*GetTrainsResponse, error) {
	scheme := in.GetScheme()
	departOn := in.GetDepartOn()
	begin := in.GetBeginStation()
	end := in.GetEndStation()
	out := new(GetTrainsResponse)
	out.Train = s.Service.GetTrains(scheme,departOn,begin,end,ctx)
	return out,nil
}
